<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
</head>

<body>
   <div id="app">
      <div v-for="user in userList">
         {{user.name}} ------- {{user.age}}
      </div>
   </div>
   <script src="vue.min.js"> </script>
   <script src="axios.min.js"></script>
   <script>
   new Vue({
      el: '#app',
      data: { //在data定义变量和初始值
          userList:[]//数组
         },
      created(){//页面渲染之前执行
         //调用定义的方法
         this.getUserList()
      },
      methods:{//编写具体的方法
         getUserList(id){
            //使用axios发送ajax请求
            //axios.get('http://localhost:8081/admin/ucenter/member')
            axios.get("data.json")
            .then(response => {
               //response就是请求之后返回数据
               //console.log(response)
               this.userList = response.data.data.items
               console.log(this.userList)
            })//请求成功执行then方法
            .catch(error =>{
               console.log('-------------'+error)
            })//请求失败执行catch方法
         }
      }
  })
  </script>
</body>

</html>